package com.heima.apis.article.fallback;

import com.heima.apis.article.ArticleFeignClient;
import com.heima.model.article.dtos.ArticleDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.common.enums.AppHttpCodeEnum;
import feign.hystrix.FallbackFactory;


public class ArticleFeignClientFallback implements FallbackFactory<ArticleFeignClient> {

    @Override
    public ArticleFeignClient create(Throwable throwable) {
        return new ArticleFeignClient() {
            @Override
            public ResponseResult<Long> saveArticle(ArticleDto articleDto) {
                return ResponseResult.errorResult(AppHttpCodeEnum.SERVER_ERROR);
            }

            @Override
            public ResponseResult findArticleById(Integer id) {
                return ResponseResult.errorResult(AppHttpCodeEnum.SERVER_ERROR);
            }
        };
    }
}
